using System.Collections.Generic;
using JlPay.Sdk.Models;

namespace JlPay.Sdk.Models.BaseData
{
    /// <summary>
    /// 地区码查询请求
    /// </summary>
    public class RegionListRequest : OrgBaseRequest
    {
        /// <summary>
        /// API接口路径
        /// </summary>
        public const string API_URL = "/open/base/data/region/list";

        /// <summary>
        /// 地区码
        /// </summary>
        public string? RegionCode { get; set; }

        /// <summary>
        /// 地区名称
        /// </summary>
        public string? RegionName { get; set; }

        /// <summary>
        /// 上级地区码
        /// </summary>
        public string? ParentCode { get; set; }

        /// <summary>
        /// 地区等级：1 省 2市 3区
        /// </summary>
        public string? RegionRank { get; set; }

        /// <summary>
        /// 每页记录数
        /// </summary>
        public int? Limit { get; set; }

        /// <summary>
        /// 偏移量，pageSize = offset / limit + 1，示例值：如果limit为10，则第二页offset传11
        /// </summary>
        public int? Offset { get; set; }

        /// <summary>
        /// 转换为字典
        /// </summary>
        /// <returns>字典数据</returns>
        public Dictionary<string, object> ToDictionary()
        {
            var data = new Dictionary<string, object>();

            // 添加基础字段
            if (!string.IsNullOrEmpty(OrgNo))
            {
                data["org_no"] = OrgNo;
            }
            if (!string.IsNullOrEmpty(MerchNo))
            {
                data["merch_no"] = MerchNo;
            }

            // 添加业务字段
            if (!string.IsNullOrEmpty(RegionCode))
            {
                data["region_code"] = RegionCode;
            }
            if (!string.IsNullOrEmpty(RegionName))
            {
                data["region_name"] = RegionName;
            }
            if (!string.IsNullOrEmpty(ParentCode))
            {
                data["parent_code"] = ParentCode;
            }
            if (!string.IsNullOrEmpty(RegionRank))
            {
                data["region_rank"] = RegionRank;
            }
            if (Limit.HasValue)
            {
                data["limit"] = Limit.Value;
            }
            if (Offset.HasValue)
            {
                data["offset"] = Offset.Value;
            }

            return data;
        }
    }
} 